<script type="text/javascript" language="JavaScript">

{literal}
	var fixHelper1 = function(e, ui) {
		ui.children('.maintr1').children().each(function() {
			$(this).width($(this).width());
		});
		return ui;
	};
{/literal}



$(function(){ldelim}
    $("#sort").sortable({ldelim}
    	opacity: 0.6,
    	helper: fixHelper1, 
    	'start': function (event, ui){ldelim}
    	        ui.placeholder.html("<tr><td colspan='5' style='height:38px;'>&nbsp;</td></tr>");
    	{rdelim},
    	cancel: ".disabled",
    	'update': function(event,ui)
    	        {ldelim}
    	          	var order = $("#sort").sortable('serialize');
    	          	    	        	//console.log(order);
    	          	
    	          	$('#AjaxResult').load("index.php?do=modules&action=modedit&mod=faq&moduleaction=savepos&cp={$sess}&"+order);
    	       {rdelim}
    {rdelim});
    $("#sort").disableSelection();
    
{rdelim});	
</script>


<div class="title"><h5>{#FAQ_EDIT_RUB#}</h5></div>

<div class="widget" style="margin-top: 0px;">
    <div class="body">
		{#FAQ_EDIT_TIP#}
    </div>
</div>


<div class="breadCrumbHolder module">
	<div class="breadCrumb module">
	    <ul>
	        <li class="firstB"><a href="index.php" title="{#MAIN_PAGE#}">{#MAIN_PAGE#}</a></li>
	        <li><a href="index.php?do=modules&amp;cp={$sess}">{#MODULES_SUB_TITLE#}</a></li>
	        <li><a href="index.php?do=modules&action=modedit&mod=faq&moduleaction=1&cp={$sess}">{#FAQ_LIST#}</a></li>
	        <li>{$RubricName|escape}</li>
	    </ul>
	</div>
</div>

<div class="widget first">
<div class="head">
<h5 class="iFrames">{if $smarty.request.id != ''}{#FAQ_EDIT_RUB#}{else}{#FAQ_EDIT_RUB#}{/if}</h5>
<div class="num"><a class="basicNum" href="index.php?do=modules&action=modedit&mod=faq&moduleaction=questedit&fid={$smarty.get.fid}&cp={$sess}">{#FAQ_ADD_QUEST#}</a></div>
<div class="num"><a class="basicNum" href="index.php?do=modules&action=modedit&mod=faq&moduleaction=1&cp={$sess}">{#FAQ_BACK#}</a></div>
</div>

{if !$questions}
	<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
			<tr>
				<td colspan="8">
					<ul class="messages">
						<li class="highlight yellow">{#FAQ_NO_ITEMS#}</li>
					</ul>
				</td>
			</tr>
		</table>
{else}
<div id="AjaxResult"></div>
	<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic mainForm">
		<thead>
		<tr>
			<td>{#FAQ_QUEST#}</td>
			<td width="400">{#FAQ_ANSWER#}</td>
			<td colspan="2" width="20">{#FAQ_ACTIONS#}</td>
		</tr>
		</thead>
		<tbody id="sort">
		{foreach from=$questions item=question}
			<tr id="item_{$question->id}" style="cursor: move;" class="maintr1">
				<td>
					<strong><a href="index.php?do=modules&action=modedit&mod=faq&moduleaction=questedit&fid={$smarty.get.fid}&id={$question->id}&cp={$sess}">{$question->faq_quest|truncate:100}</a></strong>
				</td>

				<td width="400">
					{$question->faq_answer|strip_tags|escape|truncate:80}
				</td>

				<td align="center" width="10">
					<a class="topleftDir icon_sprite ico_edit" title="{#FAQ_QEDIT_HINT#}" href="index.php?do=modules&action=modedit&mod=faq&moduleaction=questedit&fid={$smarty.get.fid}&id={$question->id}&cp={$sess}"></a>
				</td>

				<td align="center" width="10">
					<a class="topleftDir ConfirmDelete icon_sprite ico_delete" title="{#FAQ_QDELETE_HINT#}" href="index.php?do=modules&action=modedit&mod=faq&moduleaction=questdel&fid={$smarty.get.fid}&id={$question->id}&cp={$sess}"></a>
				</td>
			</tr>
		{/foreach}
		</tbody>
	</table>
{/if}
</div>